<!DOCTYPE html>
<html lang=zh>
<head>
  <meta charset="utf-8">
  
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-transform" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="format-detection" content="telephone=no,email=no,adress=no">
  <!-- Color theme for statusbar -->
  <meta name="theme-color" content="#000000" />
  <!-- 强制页面在当前窗口以独立页面显示,防止别人在框架里调用页面 -->
  <meta http-equiv="window-target" content="_top" />
  
  
  <title>基于Hexo_Gitee的博客系统搭建 | 惘客的个人博客</title>
  <meta name="description" content="安装依赖项安装Git略 安装NPM 下载安装包安装：http:&#x2F;&#x2F;nodejs.cn&#x2F;download&#x2F; 使用包管理器安装：12# macos，其他平台类似brew install npm    安装Hexo通过npm包管理器安装hexo。 1npm install -g hexo-cli # 可以用来生成hexo模板  申请Gitee账号并添加SSH公钥略 创建Gitee仓库创建存放Hexo模板">
<meta property="og:type" content="article">
<meta property="og:title" content="基于Hexo_Gitee的博客系统搭建">
<meta property="og:url" content="https://gycherish.gitee.io/blog/posts/eaf73cc8.html">
<meta property="og:site_name" content="惘客的个人博客">
<meta property="og:description" content="安装依赖项安装Git略 安装NPM 下载安装包安装：http:&#x2F;&#x2F;nodejs.cn&#x2F;download&#x2F; 使用包管理器安装：12# macos，其他平台类似brew install npm    安装Hexo通过npm包管理器安装hexo。 1npm install -g hexo-cli # 可以用来生成hexo模板  申请Gitee账号并添加SSH公钥略 创建Gitee仓库创建存放Hexo模板">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gycherish.gitee.io/blog/images/%E5%9F%BA%E4%BA%8EGitee%E5%92%8CHexo%E7%9A%84%E5%8D%9A%E5%AE%A2%E7%B3%BB%E7%BB%9F%E6%90%AD%E5%BB%BA/gitee-pages.png">
<meta property="article:published_time" content="2019-11-08T14:48:39.000Z">
<meta property="article:modified_time" content="2022-06-18T08:14:29.262Z">
<meta property="article:author" content="惘客">
<meta property="article:tag" content="hexo">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gycherish.gitee.io/blog/images/%E5%9F%BA%E4%BA%8EGitee%E5%92%8CHexo%E7%9A%84%E5%8D%9A%E5%AE%A2%E7%B3%BB%E7%BB%9F%E6%90%AD%E5%BB%BA/gitee-pages.png">
  <!-- Canonical links -->
  <link rel="canonical" href="https://gycherish.gitee.io/blog/posts/eaf73cc8.html">
  
    <link rel="alternate" href="/atom.xml" title="惘客的个人博客" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png" type="image/x-icon">
  
  
<link rel="stylesheet" href="/blog/css/style.css">

  
  
  
  
<meta name="generator" content="Hexo 4.2.1"></head>


<body class="main-center theme-black" itemscope itemtype="http://schema.org/WebPage">
  <header class="header" itemscope itemtype="http://schema.org/WPHeader">
  <div class="slimContent">
    <div class="navbar-header">
      
      
      <div class="profile-block text-center">
        <a id="avatar" href="https://gitee.com/gycherish" target="_blank">
          <img class="img-circle img-rotate" src="/blog/images/head.jpg" width="200" height="200">
        </a>
        <h2 id="name" class="hidden-xs hidden-sm">惘客</h2>
        <h3 id="title" class="hidden-xs hidden-sm hidden-md">Linux C++ Server Developer</h3>
        <small id="location" class="text-muted hidden-xs hidden-sm"><i class="icon icon-map-marker"></i> Shanghai, China</small>
      </div>
      
      <div class="search" id="search-form-wrap">

    <form class="search-form sidebar-form">
        <div class="input-group">
            <input type="text" class="search-form-input form-control" placeholder="搜索" />
            <span class="input-group-btn">
                <button type="submit" class="search-form-submit btn btn-flat" onclick="return false;"><i class="icon icon-search"></i></button>
            </span>
        </div>
    </form>
    <div class="ins-search">
  <div class="ins-search-mask"></div>
  <div class="ins-search-container">
    <div class="ins-input-wrapper">
      <input type="text" class="ins-search-input" placeholder="想要查找什么..." x-webkit-speech />
      <button type="button" class="close ins-close ins-selectable" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
    </div>
    <div class="ins-section-wrapper">
      <div class="ins-section-container"></div>
    </div>
  </div>
</div>


</div>
      <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>
    <nav id="main-navbar" class="collapse navbar-collapse" itemscope itemtype="http://schema.org/SiteNavigationElement" role="navigation">
      <ul class="nav navbar-nav main-nav ">
        
        
        <li class="menu-item menu-item-home">
          <a href="/blog/.">
            
            <i class="icon icon-home-fill"></i>
            
            <span class="menu-title">首页</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives">
            
            <i class="icon icon-archives-fill"></i>
            
            <span class="menu-title">归档</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-categories">
          <a href="/blog/categories">
            
            <i class="icon icon-folder"></i>
            
            <span class="menu-title">分类</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-tags">
          <a href="/blog/tags">
            
            <i class="icon icon-tags"></i>
            
            <span class="menu-title">标签</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-repository">
          <a href="/blog/repository">
            
            <i class="icon icon-project"></i>
            
            <span class="menu-title">项目</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-about">
          <a href="/blog/about">
            
            <i class="icon icon-cup-fill"></i>
            
            <span class="menu-title">关于</span>
          </a>
        </li>
        
      </ul>
      
	
    <ul class="social-links">
    	
        <li><a href="https://gitee.com/gycherish" target="_blank" title="Gitee" data-toggle=tooltip data-placement=top><i class="icon icon-gitee"></i></a></li>
        
        <li><a href="/blog/atom.xml" target="_blank" title="Rss" data-toggle=tooltip data-placement=top><i class="icon icon-rss"></i></a></li>
        
    </ul>

    </nav>
  </div>
</header>

  
    <aside class="sidebar" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    
      <div class="widget">
    <h3 class="widget-title">公告</h3>
    <div class="widget-body">
        <div id="board">
            <div class="content">
                <p>欢迎交流与分享经验!</p>
            </div>
        </div>
    </div>
</div>

    
      

    
      
  <div class="widget">
    <h3 class="widget-title">标签</h3>
    <div class="widget-body">
      <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/bios/" rel="tag">bios</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/c/" rel="tag">c++</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/cmake/" rel="tag">cmake</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/cpu/" rel="tag">cpu</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/develop/" rel="tag">develop</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/docker/" rel="tag">docker</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/dpdk/" rel="tag">dpdk</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/fs/" rel="tag">fs</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/git/" rel="tag">git</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/hexo/" rel="tag">hexo</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/linux/" rel="tag">linux</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/lvm/" rel="tag">lvm</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/mbr/" rel="tag">mbr</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/os/" rel="tag">os</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/phabricator/" rel="tag">phabricator</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/tmux/" rel="tag">tmux</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/blog/tags/yum/" rel="tag">yum</a><span class="tag-list-count">1</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget">
    <h3 class="widget-title">标签云</h3>
    <div class="widget-body tagcloud">
      <a href="/blog/tags/bios/" style="font-size: 13px;">bios</a> <a href="/blog/tags/c/" style="font-size: 13px;">c++</a> <a href="/blog/tags/cmake/" style="font-size: 13px;">cmake</a> <a href="/blog/tags/cpu/" style="font-size: 13px;">cpu</a> <a href="/blog/tags/develop/" style="font-size: 14px;">develop</a> <a href="/blog/tags/docker/" style="font-size: 13px;">docker</a> <a href="/blog/tags/dpdk/" style="font-size: 13px;">dpdk</a> <a href="/blog/tags/fs/" style="font-size: 13.25px;">fs</a> <a href="/blog/tags/git/" style="font-size: 13.75px;">git</a> <a href="/blog/tags/hexo/" style="font-size: 13.5px;">hexo</a> <a href="/blog/tags/linux/" style="font-size: 13.5px;">linux</a> <a href="/blog/tags/lvm/" style="font-size: 13px;">lvm</a> <a href="/blog/tags/mbr/" style="font-size: 13px;">mbr</a> <a href="/blog/tags/os/" style="font-size: 13.25px;">os</a> <a href="/blog/tags/phabricator/" style="font-size: 13px;">phabricator</a> <a href="/blog/tags/tmux/" style="font-size: 13px;">tmux</a> <a href="/blog/tags/yum/" style="font-size: 13px;">yum</a>
    </div>
  </div>

    
      
  <div class="widget">
    <h3 class="widget-title">归档</h3>
    <div class="widget-body">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2022/05/">五月 2022</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2022/04/">四月 2022</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2022/01/">一月 2022</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2021/08/">八月 2021</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2021/05/">五月 2021</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2021/03/">三月 2021</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2020/06/">六月 2020</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2020/05/">五月 2020</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2019/11/">十一月 2019</a><span class="archive-list-count">1</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget">
    <h3 class="widget-title">最新文章</h3>
    <div class="widget-body">
      <ul class="recent-post-list list-unstyled no-thumbnail">
        
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/dc0447d5.html" class="title">bios</a>
              </p>
              <p class="item-date">
                <time datetime="2022-05-17T09:35:00.000Z" itemprop="datePublished">2022-05-17</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/57db9b5a.html" class="title">Intel处理器架构简介</a>
              </p>
              <p class="item-date">
                <time datetime="2022-05-16T07:05:00.000Z" itemprop="datePublished">2022-05-16</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/7d606a33.html" class="title">高性能编程指南</a>
              </p>
              <p class="item-date">
                <time datetime="2022-04-07T09:30:00.000Z" itemprop="datePublished">2022-04-07</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/7deb74e6.html" class="title">编译编译器</a>
              </p>
              <p class="item-date">
                <time datetime="2022-01-17T13:55:50.000Z" itemprop="datePublished">2022-01-17</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-inner">
              <p class="item-category">
                
              </p>
              <p class="item-title">
                <a href="/blog/posts/aa24c566.html" class="title">编写changelog</a>
              </p>
              <p class="item-date">
                <time datetime="2021-08-13T07:59:30.000Z" itemprop="datePublished">2021-08-13</time>
              </p>
            </div>
          </li>
          
      </ul>
    </div>
  </div>
  

    
  </div>
</aside>

  
  
<main class="main" role="main">
  <div class="content">
  <article id="post-Hexo/基于Hexo_Gitee的博客系统搭建" class="article article-type-post" itemscope itemtype="http://schema.org/BlogPosting">
    
    <div class="article-header">
      
        
  
    <h1 class="article-title" itemprop="name">
      基于Hexo_Gitee的博客系统搭建
    </h1>
  

      
      <div class="article-meta">
        <span class="article-date">
    <i class="icon icon-calendar-check"></i>
	<a href="/blog/posts/eaf73cc8.html" class="article-date">
	  <time datetime="2019-11-08T14:48:39.000Z" itemprop="datePublished">2019-11-08</time>
	</a>
</span>
        
        
  <span class="article-tag">
    <i class="icon icon-tags"></i>
	<a class="article-tag-link" href="/blog/tags/hexo/" rel="tag">hexo</a>
  </span>


        
	<span class="article-read hidden-xs">
	    <i class="icon icon-eye-fill" aria-hidden="true"></i>
	    <span id="busuanzi_container_page_pv">
			<span id="busuanzi_value_page_pv">0</span>
		</span>
	</span>


        <span class="post-comment"><i class="icon icon-comment"></i> <a href="/blog/posts/eaf73cc8.html#comments" class="article-comment-link">评论</a></span>
        
      </div>
    </div>
    <div class="article-entry marked-body" itemprop="articleBody">
      
        <h2 id="安装依赖项"><a href="#安装依赖项" class="headerlink" title="安装依赖项"></a>安装依赖项</h2><h3 id="安装Git"><a href="#安装Git" class="headerlink" title="安装Git"></a>安装Git</h3><p>略</p>
<h3 id="安装NPM"><a href="#安装NPM" class="headerlink" title="安装NPM"></a>安装NPM</h3><ol>
<li>下载安装包安装：<a href="http://nodejs.cn/download/" target="_blank" rel="noopener">http://nodejs.cn/download/</a></li>
<li>使用包管理器安装：<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># macos，其他平台类似</span></span><br><span class="line">brew install npm</span><br></pre></td></tr></table></figure>

</li>
</ol>
<h3 id="安装Hexo"><a href="#安装Hexo" class="headerlink" title="安装Hexo"></a>安装Hexo</h3><p>通过npm包管理器安装hexo。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-cli <span class="comment"># 可以用来生成hexo模板</span></span><br></pre></td></tr></table></figure>

<h2 id="申请Gitee账号并添加SSH公钥"><a href="#申请Gitee账号并添加SSH公钥" class="headerlink" title="申请Gitee账号并添加SSH公钥"></a>申请Gitee账号并添加SSH公钥</h2><p>略</p>
<h2 id="创建Gitee仓库"><a href="#创建Gitee仓库" class="headerlink" title="创建Gitee仓库"></a>创建Gitee仓库</h2><h3 id="创建存放Hexo模板的私有仓库blog-priv"><a href="#创建存放Hexo模板的私有仓库blog-priv" class="headerlink" title="创建存放Hexo模板的私有仓库blog-priv"></a>创建存放Hexo模板的私有仓库blog-priv</h3><p>该仓库用于存放博客的所有源文件，方便以后博客的迁移和同步。</p>
<h3 id="创建用于发布博客的公有仓库blog"><a href="#创建用于发布博客的公有仓库blog" class="headerlink" title="创建用于发布博客的公有仓库blog"></a>创建用于发布博客的公有仓库blog</h3><p>该仓库作为博客系统用于以网页的形式展示所有博客内容，该内容由blog-priv仓库生成。</p>
<h3 id="为blog仓库配置Pages服务"><a href="#为blog仓库配置Pages服务" class="headerlink" title="为blog仓库配置Pages服务"></a>为blog仓库配置Pages服务</h3><p>开启该服务后将可以通过url访问到该博客系统。<br><img src="/blog/images/%E5%9F%BA%E4%BA%8EGitee%E5%92%8CHexo%E7%9A%84%E5%8D%9A%E5%AE%A2%E7%B3%BB%E7%BB%9F%E6%90%AD%E5%BB%BA/gitee-pages.png" alt=""></p>
<h2 id="配置Hexo"><a href="#配置Hexo" class="headerlink" title="配置Hexo"></a>配置Hexo</h2><h3 id="克隆blog-priv仓库"><a href="#克隆blog-priv仓库" class="headerlink" title="克隆blog-priv仓库"></a>克隆blog-priv仓库</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> git@gitee.com:gycherish/blog-priv.git</span><br></pre></td></tr></table></figure>

<h3 id="执行初始化命令"><a href="#执行初始化命令" class="headerlink" title="执行初始化命令"></a>执行初始化命令</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo init blog-priv</span><br></pre></td></tr></table></figure>

<h3 id="修改blog-priv中的配置文件"><a href="#修改blog-priv中的配置文件" class="headerlink" title="修改blog-priv中的配置文件"></a>修改blog-priv中的配置文件</h3><figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># _config.yml</span></span><br><span class="line"><span class="attr">title:</span> <span class="string">xxx</span>  <span class="comment"># 博客标题</span></span><br><span class="line"><span class="attr">author:</span> <span class="string">xxx</span> <span class="comment"># 作者</span></span><br><span class="line"></span><br><span class="line"><span class="attr">url:</span> <span class="string">https://gycherish.gitee.io/blog</span> <span class="comment"># 博客地址: blog为上文中创建的公有仓库，下同</span></span><br><span class="line"><span class="attr">root:</span> <span class="string">/blog</span>                          <span class="comment"># 根路径</span></span><br><span class="line"></span><br><span class="line"><span class="attr">deploy:</span></span><br><span class="line">  <span class="attr">type:</span> <span class="string">git</span>                                    <span class="comment"># 部署的仓库类型</span></span><br><span class="line">  <span class="comment"># repo: https://gitee.com/gycherish/blog     # 部署的仓库地址： 部署时需要使用Gitee的用户名和密码</span></span><br><span class="line">  <span class="attr">repo:</span> <span class="string">git@gitee.com:gycherish/blog.git</span>       <span class="comment"># 部署的仓库地址： 添加了SSH公钥后不需要密码直接部署</span></span><br><span class="line">  <span class="attr">branch:</span> <span class="string">master</span>                               <span class="comment"># 部署的仓库分支</span></span><br></pre></td></tr></table></figure>

<h3 id="生成并部署"><a href="#生成并部署" class="headerlink" title="生成并部署"></a>生成并部署</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># hexo d命令需要hexo-deployer-git</span></span><br><span class="line">npm install hexo-deployer-git --save <span class="comment"># 用于部署博客到blog仓库，通过git自动提交</span></span><br><span class="line"></span><br><span class="line">hexo g &amp;&amp; hexo d <span class="comment"># generate, deploy，为了清除之前生成且目前已经删除的博客需要先执行hexo clean</span></span><br></pre></td></tr></table></figure>

<h3 id="本地预览"><a href="#本地预览" class="headerlink" title="本地预览"></a>本地预览</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo g &amp;&amp; hexo s <span class="comment"># 生成博客后启动hexo本地http服务器，打开浏览器进入http://localhost:4000即可查看</span></span><br></pre></td></tr></table></figure>

<h3 id="更新Pages"><a href="#更新Pages" class="headerlink" title="更新Pages"></a>更新Pages</h3><p>注意，上文中虽然为blog仓库开启了Pages服务，并且通过hexo deply命令将博客内容提交到了blog仓库，但是为了通过url能看到博客最新的改动仍然需要到blog仓库的Pages界面手动点击更新按钮。</p>
<h2 id="图片引用"><a href="#图片引用" class="headerlink" title="图片引用"></a>图片引用</h2><p>Hexo引用图片有多种方式，这里只考虑其中一种，即：在blog-priv/source目录下创建images目录，为了避免不同博客引用的图片太多不方便管理，再在images目录下以每篇博客名分别创建对应的文件夹，如xxx，并在该目录下放置当前xxx.md用到的所有图片，最终只需要按以下方式引用图片即可：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">![](&#x2F;blog&#x2F;images&#x2F;xxx&#x2F;xxx.png) # &#x2F;blog为博客的root配置</span><br></pre></td></tr></table></figure>

<h2 id="注意事项"><a href="#注意事项" class="headerlink" title="注意事项"></a>注意事项</h2><ol>
<li><p>对于第一次搭建环境，在执行hexo init命令时blog-priv目录下会自动生成node_modules目录，里面含有hexo命令，这样每次在blog-priv目录中执行hexo命令时可达到想要的效果，但是由于node_modules不会被提交到git仓库中，因此，对于以后只是为了写博客而言，为了使hexo命令能够正常使用，需要进入到blog-priv目录中手动安装hexo的依赖项：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install --save</span><br></pre></td></tr></table></figure>
</li>
<li><p>文章的英文大小写命名的调整可能会导致生成的博客标签无法访问(404)，原因在于.deploy_git/.git/config中忽略了大小写，进而导致部署到blog仓库中的博客路径和本地不一致。只需要做一下修改即可：</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">[core]</span></span><br><span class="line">        repositoryformatversion = 0</span><br><span class="line">        filemode = false</span><br><span class="line">        bare = false</span><br><span class="line">        logallrefupdates = true</span><br><span class="line">        symlinks = false</span><br><span class="line">        ignorecase = false # 原来是true，现改为false</span><br><span class="line"><span class="section">[branch "master"]</span></span><br><span class="line">        remote = git@gitee.com:gycherish/blog.git</span><br><span class="line">        merge = refs/heads/master</span><br></pre></td></tr></table></figure>
<p>为了删除之前错误发布的博客，可以先清空.deploy_git目录并执行一次hexo d，这样blog仓库的内容就被当前提交清空了，下次执行hexo clean &amp;&amp; hexo g &amp;&amp; hexo d就会生成最新的博客内容。</p>
</li>
</ol>
<h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><ol>
<li>第一次搭建环境按照上述步骤处理即可</li>
<li>以后只是为了同步，则走下面步骤即可：<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 1. 安装npm，在windows平台可下载安装包</span></span><br><span class="line">brew install npm</span><br><span class="line"></span><br><span class="line"><span class="comment"># 2. 克隆仓库</span></span><br><span class="line">git <span class="built_in">clone</span> git@gitee.com:gycherish/blog-priv.git</span><br><span class="line"></span><br><span class="line"><span class="comment"># 3.在blog-priv生成需要的工具</span></span><br><span class="line"><span class="built_in">cd</span> blog-priv </span><br><span class="line">npm install hexo --save</span><br><span class="line">npm install hexo-deployer-git --save</span><br><span class="line"></span><br><span class="line"><span class="comment"># 4. 增加、修改、删除文章</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 5. 本地预览或者部署</span></span><br><span class="line">hexo g &amp;&amp; hexo s <span class="comment"># hexo d</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 6. 更新pages服务</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 7. 提交并推送对blog-priv仓库的修改</span></span><br></pre></td></tr></table></figure>

</li>
</ol>
<h2 id="相关链接"><a href="#相关链接" class="headerlink" title="相关链接"></a>相关链接</h2><ul>
<li><a href="https://nodejs.org" target="_blank" rel="noopener">Nodejs官网</a></li>
<li><a href="https://hexo.io/zh-cn/" target="_blank" rel="noopener">Hexo中文官网</a></li>
</ul>

      
    </div>
    <div class="article-footer">
      <blockquote class="mt-2x">
  <ul class="post-copyright list-unstyled">
    
    <li class="post-copyright-link hidden-xs">
      <strong>本文链接：</strong>
      <a href="https://gycherish.gitee.io/blog/posts/eaf73cc8.html" title="基于Hexo_Gitee的博客系统搭建" target="_blank" rel="external">https://gycherish.gitee.io/blog/posts/eaf73cc8.html</a>
    </li>
    
    <li class="post-copyright-license">
      <strong>版权声明： </strong> 本博客所有文章除特别声明外，均采用 <a href="http://creativecommons.org/licenses/by/4.0/deed.zh" target="_blank" rel="external">CC BY 4.0 CN协议</a> 许可协议。转载请注明出处！
    </li>
  </ul>
</blockquote>


<div class="panel panel-default panel-badger">
  <div class="panel-body">
    <figure class="media">
      <div class="media-left">
        <a href="https://gitee.com/gycherish" target="_blank" class="img-burn thumb-sm visible-lg">
          <img src="/blog/images/head.jpg" class="img-rounded w-full" alt="">
        </a>
      </div>
      <div class="media-body">
        <h3 class="media-heading"><a href="https://gitee.com/gycherish" target="_blank"><span class="text-dark">惘客</span><small class="ml-1x">Linux C++ Server Developer</small></a></h3>
        <div>宁静致远，淡泊明志！</div>
      </div>
    </figure>
  </div>
</div>


    </div>
  </article>
  
    
  <section id="comments">
  	
  </section>


  
</div>

  <nav class="bar bar-footer clearfix" data-stick-bottom>
  <div class="bar-inner">
  
  <ul class="pager pull-left">
    
    <li class="prev">
      <a href="/blog/posts/53c754a2.html" title="C++编码风格指南"><i class="icon icon-angle-left" aria-hidden="true"></i><span>&nbsp;&nbsp;上一篇</span></a>
    </li>
    
    
    
  </ul>
  
  
  <!-- Button trigger modal -->
  <button type="button" class="btn btn-fancy btn-donate pop-onhover bg-gradient-warning" data-toggle="modal" data-target="#donateModal"><span>赏</span></button>
  <!-- <div class="wave-icon wave-icon-danger btn-donate" data-toggle="modal" data-target="#donateModal">
    <div class="wave-circle"><span class="icon"><i class="icon icon-bill"></i></span></div>
  </div> -->
  
  
  <div class="bar-right">
    
    <div class="share-component" data-sites="weibo,qq,wechat,facebook,twitter" data-mobile-sites="weibo,qq,qzone"></div>
    
  </div>
  </div>
</nav>
  
<!-- Modal -->
<div class="modal modal-center modal-small modal-xs-full fade" id="donateModal" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content donate">
      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <div class="modal-body">
        <div class="donate-box">
          <div class="donate-head">
            <p>感谢您的支持，我会继续努力的!</p>
          </div>
          <div class="tab-content">
            <div role="tabpanel" class="tab-pane fade active in" id="alipay">
              <div class="donate-payimg">
                <img src="/blog/images/donate/alipay.jpg" alt="扫码支持" title="扫一扫" />
              </div>
              <p class="text-muted mv">扫码打赏，你说多少就多少</p>
              <p class="text-grey">打开支付宝扫一扫，即可进行扫码打赏哦</p>
            </div>
            <div role="tabpanel" class="tab-pane fade" id="wechatpay">
              <div class="donate-payimg">
                <img src="/blog/images/donate/wechatpay.jpg" alt="扫码支持" title="扫一扫" />
              </div>
              <p class="text-muted mv">扫码打赏，你说多少就多少</p>
              <p class="text-grey">打开微信扫一扫，即可进行扫码打赏哦</p>
            </div>
          </div>
          <div class="donate-footer">
            <ul class="nav nav-tabs nav-justified" role="tablist">
              <li role="presentation" class="active">
                <a href="#alipay" id="alipay-tab" role="tab" data-toggle="tab" aria-controls="alipay" aria-expanded="true"><i class="icon icon-alipay"></i> 支付宝</a>
              </li>
              <li role="presentation" class="">
                <a href="#wechatpay" role="tab" id="wechatpay-tab" data-toggle="tab" aria-controls="wechatpay" aria-expanded="false"><i class="icon icon-wepay"></i> 微信支付</a>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>



</main>

  <footer class="footer" itemscope itemtype="http://schema.org/WPFooter">
	
	
    <ul class="social-links">
    	
        <li><a href="https://gitee.com/gycherish" target="_blank" title="Gitee" data-toggle=tooltip data-placement=top><i class="icon icon-gitee"></i></a></li>
        
        <li><a href="/blog/atom.xml" target="_blank" title="Rss" data-toggle=tooltip data-placement=top><i class="icon icon-rss"></i></a></li>
        
    </ul>

    <div class="copyright">
    	
        &copy; 2024 惘客
        
        <!-- <div class="publishby">
        	Theme by <a href="https://github.com/cofess" target="_blank"> cofess </a>base on <a href="https://github.com/cofess/hexo-theme-pure" target="_blank">pure</a>.
        </div> -->
        <div class="police">
            <img src="/blog/images/beian.png" style="float:left;" /><a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=41152702000156" target="_blank">豫公网安备41152702000156号</a>
        </div>
        <div class="beianinfo">
            <a href="https://beian.miit.gov.cn/" target="_blank">豫ICP备2021012829号</a>
        </div>
    </div>
</footer>
  <script src="//cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>

<script src="/blog/js/plugin.min.js"></script>


<script src="/blog/js/application.js"></script>


    <script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: '文章',
            PAGES: '页面',
            CATEGORIES: '分类',
            TAGS: '标签',
            UNTITLED: '(未命名)',
        },
        ROOT_URL: '/blog/',
        CONTENT_URL: '/blog/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>

<script src="/blog/js/insight.js"></script>






   
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>





   







<!-- 添加回到顶部按钮 -->
<div id="go-top"></div>
<style type="text/css">
#go-top {
 width:40px;height:40px;
 background-color:#8cc2ff;
 position:relative;
 border-radius:20px;
 position:fixed;right:10px;bottom:60px;
 cursor:pointer;display:none;
}
#go-top:after {
 content:" ";
 position:absolute;left:14px;top:14px;
 border-top:2px solid #fff;border-right:2px solid #fff;
 width:12px;height:12px;
 transform:rotate(-45deg);
}
#go-top:hover {
 background-color:#8A2BE2;
}
</style>
<script>
$(function () {
  var top=$("#go-top");
  $(window).scroll(function () {
    ($(window).scrollTop() > 300) ? top.show(300) : top.hide(200);
    $("#go-top").click(function () {
      $('body,html').animate({scrollTop:0});
      return false();
    })
  });
});
</script>
</body>
</html>